package com.yaosheng.thread.app;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yaosheng on 2021/7/5.
 */
public class TickerSeller {

    static List<String> tickets = new ArrayList<> ();

    static {
        for (int i = 0;i < 10000;i ++){
            tickets.add ("车票编号:" + i);
        }
    }

    public static void main(String[] args) {

        for(int i = 0;i < 10;i ++){
            new Thread ( () -> {
                while (tickets.size () > 0){
                    System.out.println ("销售了--" + tickets.remove (0));
                }
            }).start ();
        }
    }
}
